package com.appwoo.txtws.activity;

import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import android.widget.ToggleButton;
import com.appwoo.android.activity.BaseActivity;
import com.appwoo.android.exception.NotFoundNetWorkException;
import com.appwoo.android.exception.TimeOutException;
import com.appwoo.txtws.bean.MessageBean;
import com.appwoo.txtws.bean.TimeConfigBean;
import com.appwoo.txtws.component.RqSP;
import com.appwoo.txtws.service.TimerService;
import java.io.IOException;
import org.xmlpull.v1.XmlPullParserException;

public class OtherProtectActivity extends BaseActivity
  implements View.OnClickListener
{
  private static int controlType = -1;
  private static boolean net = false;
  private static boolean srn = false;
  private String alertString = "";
  private String equipname = "";
  private ToggleButton linear_choose_cutnet;
  private ToggleButton linear_choose_locksrn;
  private MessageBean mBean = null;
  private TimeConfigBean tcfBean = null;
  private TextView textview_protect_back;
  private TimerService timerService = null;
  private TextView tv_protect_submit;
  private String userId = "";
  private ProgressDialog v_progressDialog;

  private void addListener()
  {
    this.textview_protect_back.setOnClickListener(this);
    this.tv_protect_submit.setOnClickListener(this);
  }

  private String bgADtcf(String paramString)
  {
    if (paramString.equals(""))
      this.alertString = getString(2131427772);
    while (true)
    {
      return this.alertString;
      if (this.equipname != null)
        try
        {
          if (this.timerService == null)
            this.timerService = new TimerService();
          this.mBean = this.timerService.adTimeConfigCmdType(this.userId, this.equipname, paramString, this);
          if (!this.mBean.getCode().equals("0"))
            this.alertString = this.mBean.getDesc();
        }
        catch (IOException localIOException)
        {
          localIOException.printStackTrace();
          continue;
          this.alertString = getString(2131427527);
        }
        catch (XmlPullParserException localXmlPullParserException)
        {
          localXmlPullParserException.printStackTrace();
        }
        catch (TimeOutException localTimeOutException)
        {
          localTimeOutException.printStackTrace();
        }
        catch (NotFoundNetWorkException localNotFoundNetWorkException)
        {
          localNotFoundNetWorkException.printStackTrace();
        }
    }
  }

  private String bgRQTimeConfig()
  {
    if (this.equipname != null);
    try
    {
      this.tcfBean = this.timerService.RQTimeConfig(this.userId, this.equipname, this);
      String str = this.tcfBean.getCmdType();
      return str;
    }
    catch (IOException localIOException)
    {
      localIOException.printStackTrace();
      return this.alertString;
    }
    catch (XmlPullParserException localXmlPullParserException)
    {
      while (true)
        localXmlPullParserException.printStackTrace();
    }
    catch (TimeOutException localTimeOutException)
    {
      while (true)
        localTimeOutException.printStackTrace();
    }
    catch (NotFoundNetWorkException localNotFoundNetWorkException)
    {
      while (true)
        localNotFoundNetWorkException.printStackTrace();
    }
  }

  private void createOrShowDialog()
  {
    if ((this.v_progressDialog == null) || (!this.v_progressDialog.isShowing()))
    {
      this.v_progressDialog = new ProgressDialog(this);
      this.v_progressDialog.setMessage(getString(2131427516));
      this.v_progressDialog.setCancelable(true);
      if (!this.v_progressDialog.isShowing())
        this.v_progressDialog.show();
    }
  }

  private String dealWithProtect()
  {
    String str = "";
    boolean bool1 = this.linear_choose_cutnet.isChecked();
    boolean bool2 = this.linear_choose_locksrn.isChecked();
    if ((bool1) && (bool2))
      str = "2";
    do
    {
      return str;
      if ((bool2) && (!bool1))
        return "1";
    }
    while ((bool2) || (!bool1));
    return "0";
  }

  private void init()
  {
    this.linear_choose_cutnet = ((ToggleButton)findViewById(2131493567));
    this.linear_choose_locksrn = ((ToggleButton)findViewById(2131493568));
    this.textview_protect_back = ((TextView)findViewById(2131493566));
    this.tv_protect_submit = ((TextView)findViewById(2131493569));
    this.timerService = new TimerService();
    RqSP localRqSP = new RqSP();
    this.equipname = localRqSP.getLgDevId(this);
    this.userId = localRqSP.getLgDevAccount(this);
    new ProtectAsyncTask().execute(new String[] { "rqTime" });
  }

  private void postRQtcf(String paramString)
  {
    if (!paramString.equals(""))
    {
      if (!paramString.equals("0"))
        break label47;
      this.linear_choose_cutnet.setChecked(true);
      this.linear_choose_locksrn.setChecked(false);
      controlType = 0;
      net = true;
      srn = false;
    }
    label47: 
    do
    {
      return;
      if (paramString.equals("1"))
      {
        this.linear_choose_cutnet.setChecked(false);
        this.linear_choose_locksrn.setChecked(true);
        controlType = 1;
        net = false;
        srn = true;
        return;
      }
    }
    while (!paramString.equals("2"));
    this.linear_choose_cutnet.setChecked(true);
    this.linear_choose_locksrn.setChecked(true);
    controlType = 2;
    net = true;
    srn = true;
  }

  private void postUdCtrl(String paramString)
  {
    if (!paramString.equals(""))
    {
      alertMessage(this.alertString);
      return;
    }
    alertMessage(getString(2131427528));
  }

  public void onBackPressed()
  {
    super.onBackPressed();
    backAcitvity(this);
  }

  public void onClick(View paramView)
  {
    switch (paramView.getId())
    {
    case 2131493567:
    case 2131493568:
    default:
      return;
    case 2131493566:
      backAcitvity(this);
      return;
    case 2131493569:
    }
    new ProtectAsyncTask().execute(new String[] { "udCtrl" });
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903217);
    init();
    addListener();
  }

  public class ProtectAsyncTask extends AsyncTask<String, Integer, String>
  {
    private String method = "";

    public ProtectAsyncTask()
    {
    }

    protected String doInBackground(String[] paramArrayOfString)
    {
      this.method = paramArrayOfString[0];
      if (this.method.equals("rqTime"))
        return OtherProtectActivity.this.bgRQTimeConfig();
      if (this.method.equals("udCtrl"))
        return OtherProtectActivity.this.bgADtcf(OtherProtectActivity.access$1(OtherProtectActivity.this));
      return "";
    }

    protected void onPostExecute(String paramString)
    {
      if (this.method.equals("rqTime"))
        if ((paramString == null) || (paramString.equals("")))
          OtherProtectActivity.this.alertMessage(OtherProtectActivity.this.getString(2131427771));
      while (true)
      {
        OtherProtectActivity.this.v_progressDialog.dismiss();
        return;
        OtherProtectActivity.this.postRQtcf(paramString);
        continue;
        if (this.method.equals("udCtrl"))
          OtherProtectActivity.this.postUdCtrl(paramString);
      }
    }

    protected void onPreExecute()
    {
      OtherProtectActivity.this.createOrShowDialog();
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.activity.OtherProtectActivity
 * JD-Core Version:    0.6.2
 */